<%-- 
    Document   : manage_list
    Created on : Nov 5, 2011, 3:11:32 PM
    Author     : Yudi Retanto
--%>

<%@page import="com.moedik.classes.BusService"%>
<%@page import="com.moedik.model.ShuttleModel"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
    <tr>
        <script type="text/javascript">
    function deleteSchedule(id,obj){
        var answer = confirm("Apakah ingin menghapus jadwal ini?");
        if (answer){
            var parent = $(obj).parent().parent();
            $.ajax({
                type: 'get',
                url: 'shippings',
                data: 'action=manage&mode=delete&service=' + id,
                beforeSend: function() {
                    parent.fadeTo('slow', 0.25);
                },
                success: function() {
                    parent.find('td').wrapInner('<div style="display: block;" />').parent().find('td > div').slideUp(300, function() {
                        parent.remove();
                    });
                },
                error: function() {
                    parent.stop().fadeTo('slow', 1);
                }
            });
        }
    }
</script>
        <th class="td-no">No</th>
        <th>Jenis Pengiriman Paket</th>
        <th>Harga (/Kg)</th>
        <th>Action</th>
    </tr>
    <c:forEach items="${services}" var="shipping">
        <c:set var="ordinal" value="${ordinal + 1}" />
        <tr id="record-${shipping.getId()}">
            <td class="td-no">${ordinal}</td>
            <td>${shipping.getQos()}</td>
            <td>${shipping.getCost()}</td>
            <td>
                <a href="./shippings?action=manage&mode=edit&service=${shipping.getId()}">Edit</a>
                <a href="#" onclick="deleteSchedule(${shipping.getId()},this)">Delete</a>
            </td>
        </tr>
    </c:forEach>
